﻿using System.Windows;
using System.Windows.Input;
using MimicAPI.DWM;
using MimicAPI.Window;

namespace Mimic
{
    /// <summary>Main window</summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RefreshWindowsList();
            this.ExtendGlassFrame(new Thickness(-1));
            this.EnableBlurBehindWindow();
        }

        void Thumbnail_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ThumbControl selectedThumb = sender as ThumbControl;
            if (selectedThumb != null)
                new ThumbnailWindow(this, selectedThumb.Source).Show();
        }

        void Button_Click(object sender, RoutedEventArgs e)
        {
            RefreshWindowsList();
        }

        internal void RefreshWindowsList()
        {
            this.DataContext = this.GetVisibleWindows(false, cbRefresh.IsChecked.HasValue && cbRefresh.IsChecked.Value);
        }
    }
}
